#version 320 es
precision mediump float;

out vec4 fragColor;
in vec2 v_TexCoord;

uniform sampler2D u_texture;
uniform int u_texture_type;

void main() {

    if ( u_texture_type != 3) {
        vec3 color = texture(u_texture, v_TexCoord).rgb;
        fragColor = vec4(color, 1.0);
    }
    else{
        float spec = texture(u_texture, v_TexCoord).a;
        fragColor = 1.0 - vec4(spec, spec, spec, 1.0);
    }
}